package com.xyq.friend.controller.question;

import com.xyq.common.core.domain.Result;
import com.xyq.common.core.domain.TableDataInfo;
import com.xyq.friend.aspect.CheckStatus;
import com.xyq.friend.domain.question.dto.QuestionSelectDTO;
import com.xyq.friend.service.question.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/question")
public class QuestionController {
    @Autowired
    private QuestionService questionService;

    @GetMapping("noLogin/list")
    public TableDataInfo list(QuestionSelectDTO questionSelectDTO) {
     return     questionService.list(questionSelectDTO) ;
    }
    @CheckStatus

    @GetMapping("/detail")
    public Result detail(Long questionId , Long examId){

         return  Result.success(questionService.detial(questionId,examId)) ;
    }
    // 上一题
    @CheckStatus

    @GetMapping("/preQuestion")
    public Result preQuestion(Long questionId){
        return  Result.success(questionService.preQuestion(questionId)) ;
    }
    // 下一题
    @CheckStatus

    @GetMapping("/nextQuestion")
    public Result nextQuestion(Long questionId){
        return  Result.success(questionService.nextQuestion(questionId)) ;
    }

    @GetMapping("/noLogin/hotQuestionList")
    public Result  hotQuestion(){
         return Result.success(questionService.hotQuestion());
    }

}
